;;;Place a standard Profile Grid array
;;;beginning at the lower left point you specify and
;;;terminating at the upper right point you specify.
;;;
;;;Uses UPOINT.LSP, MKLAYR.LSP
;;;
;;;	AUTHOR: HENRY C. FRANCIS
;;;		425 N. ASHE ST.
;;;		SOUTHERN PINES, NC 28387
;;;		All rights reserved without prejudice.
;;;
;;;	Copyright:	5-28-96
;;;	Edited:		12-6-2005
;;;
(defun c:adgrid ( / this_grid_ss)
  (if upoint nil (load "upoint" "\nFile UPOINT.LSP not loaded! "))
  (setq llcor (upoint 1 "" "Lower left corner of new grid area" (if llcor llcor nil) nil))
  (setq urcor (upoint 1 "" "Upper right corner of new grid area" (if urcor urcor nil) nil))
  (if ukword nil (load "ukword" "\nFile UKWORD.LSP not loaded! "))
  (setq inter_grid (ukword 1 "Yes No" "Draw intermediate grid lines?" inter_grid))
  (setq llx (car llcor)
        lly (cadr llcor)
        llz (caddr llcor)
        urx (car urcor)
        ury (cadr urcor)
        hgy lly
        vgx llx
        count 0
  );setq
  (setq mjrg "C"
        llt "-"
        prod "SHBD"
        colra ""
        modf "GRID"
  );setq
  (SETQ this_grid_ss (SSADD))
  (if mklayr nil (load "mklayr" "\nFile MKLAYR.LSP not loaded! "))
  (c:mklayr)
  (while
    (<= hgy ury)
    (if(eq(rem count 5)0)
      (progn
        (setq colra "E");horizontal index color symbol
        (c:mklayr)
        (entmake
          (list
            (cons 0 "LINE")
            (cons 10 (list llx hgy llz))
            (cons 11 (list urx hgy llz))
          )
        )
        (SSADD (entlast) this_grid_ss)
        (setq colra "D");horizontal intermediate color symbol
        (c:mklayr)
      );progn
      (progn
        (if inter_grid
          (progn
            (entmake
              (list
                (cons 0 "LINE")
                (cons 10 (list llx hgy llz))
                (cons 11 (list urx hgy llz))
              )
            )
            (SSADD (entlast) this_grid_ss)
          )
        )
      )
    );if
    (setq hgy (+ hgy 5))
    (setq count (1+ count))
  );while
  (setq count 0)
  (while
    (<= vgx urx)
    (if(eq(rem count 4)0)
      (progn
        (setq colra "5");vertical index color symbol
        (c:mklayr)
        (entmake
          (list
            (cons 0 "LINE")
            (cons 10 (list vgx lly llz))
            (cons 11 (list vgx ury llz))
          )
        )
        (SSADD (entlast) this_grid_ss)
        (setq colra "5");vertical intermediate color symbol
        (c:mklayr)
      );progn
      (progn
        (if inter_grid
          (progn
            (entmake
              (list
                (cons 0 "LINE")
                (cons 10 (list vgx lly llz))
                (cons 11 (list vgx ury llz))
              )
            )
            (SSADD (entlast) this_grid_ss)
          )
        )
      )
    );if
    (setq vgx (+ vgx 25))
    (setq count (1+ count))
  );while
  (if this_grid_ss
    (progn
      (command ".-group" "create" (strcat "GRID-" (RTOS(getvar"cdate")2 0)(SUBSTR (RTOS(* (getvar"cdate")100000)2 0)9)) "" this_grid_ss "")
    )
  )
  (princ)
);defun
